#include "mapController.h"
#include "view/camera/ortho_camera.h"

MapController::MapController(View* view,Model* model)  : SceneController(view,model) {
}

MapController::~MapController(){
}

void MapController::specKeyboard(int key,int x ,int y){
	SceneController::specKeyboard(key,x,y);

	/*SceneModel& smodel = dynamic_cast<SceneModel&>(*model);
	SceneView& sview = dynamic_cast<SceneView&>(*view);
	Helicopter& heli = smodel.getHelicopter();
	OrthoCamera& camera = dynamic_cast<OrthoCamera&>(sview.getCamera());

	float hfactor = heli.getDimensions().center().x3/smodel.getSceneCube().height()*20.0f;

	switch(key){
		case GLUT_KEY_PAGE_UP:
			camera.setViewVolume(Cube(Point(-25-hfactor,-25-hfactor,-60),Point(25+hfactor,25+hfactor,80)));
			break;
		case GLUT_KEY_PAGE_DOWN:
			camera.setViewVolume(Cube(Point(-25-hfactor,-25-hfactor,-60),Point(25+hfactor,25+hfactor,80)));
			break;
	}*/
}

void MapController::timer(int value){
	SceneModel& smodel = static_cast<SceneModel&>(*model);
	smodel.timer(value);

	SceneView& sview = dynamic_cast<SceneView&>(*view);
	Helicopter& heli = smodel.getHelicopter();
	Point center = heli.getDimensions().center();
	center.x3+=3;
	sview.getCamera().updatePosition(center,Point(0,0,-1),NULL);
}

